<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateCoursesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        //课程
        Schema::create('courses', function (Blueprint $table) {
            $table->id();

            $table->unsignedInteger('course_categories_id')->comment("课程类别id");
            $table->unsignedInteger('course_lecturer_id')->comment("讲师id");
            $table->string('name')->comment("名称");
            $table->string('pic',100)->comment('课程封面')->nullable();
            $table->tinyInteger("chapter")->default(0)->comment("章节数量");
            $table->text('abstract')->comment("简介")->nullable();
            $table->unsignedInteger('praise')->default(0)->comment("点赞量");
            $table->unsignedInteger('pv')->default(0)->comment("浏览量");
            $table->tinyInteger("recommend")->default(0)->comment("是否推荐[否,是]");
            $table->tinyInteger("free")->default(0)->comment("是否免费[否,是]");
            $table->unsignedInteger('sorting')->comment("排序")->default(0)->nullable() ;
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('courses');
    }
}
